home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / mikecom / comm.h < prev    next >
Text File  |  1987-05-21  |  4KB  |  70 lines

  1.  
  2. /******************************************************************************
  3.  COMM.H -- header file for C programs using async functions.
  4.  
  5.    Mike Dumdei,  6 Holly Lane,  Texarkana TX  75503
  6.  
  7. ******************************************************************************/
  8.  
  9. #define         COM1            1
  10. #define         COM2            2
  11.  
  12. /*  ---- Return codes ----  */
  13. #define         R_OK            0
  14. #define         R_NOPORT       -1
  15. #define         R_PORTINUSE    -2
  16. #define         R_BAUDERR      -3
  17. #define         R_PARITYERR    -4
  18. #define         R_DTABITERR    -5
  19. #define         R_STPBITERR    -6
  20. #define         R_BADARG       -7
  21. #define         R_NOMEM        -8
  22. #define         R_TXERR        -9
  23.  
  24.  
  25. /*  ---- Bit masks ----  */
  26.                         /*    S T A T 2    */
  27. #define         B_XUSE       0x0001     /* using XON/XOFF protocol bit */
  28. #define         B_XRXD       0x0002     /* XOFF received bit */
  29. #define         B_XSENT      0x0004     /* XOFF sent bit */
  30. #define         B_TXEMPTY    0x0008     /* nothing to transmit bit */
  31. #define         B_CTS        0x0010     /* clear to send bit */
  32. #define         B_DSR        0x0020     /* data set ready bit */
  33. #define         B_FLOWHALT   0x0040     /* flow halt indicator bit */
  34. #define         B_MNTR_CD    0x0080     /* monitor CD bit */
  35.  
  36.                         /*    S T A T 1    */
  37. #define         B_RXOVF      0x0100     /* rx buffer overflow indic bit */
  38. #define         B_OVERRUN    0x0200     /* char overrun error bit */
  39. #define         B_PARITY     0x0400     /* parity error bit */
  40. #define         B_FRAMING    0x0800     /* framing error bit */
  41. #define         B_BREAK      0x1000     /* line break signal detected */
  42. #define         B_BADPORT    0x2000     /* bad port bit */
  43. #define         B_RXEMPTY    0x4000     /* rx buffer empty bit */
  44. #define         B_CD         0x8000     /* carrier detect bit mask */
  45.  
  46.  
  47. /* ---- Function declarations ---- */
  48. int     async_open(int, char *, int, int);      /* open async port */
  49. int     async_close(int);                       /* close async port */
  50. int     async_tx(int, char);                    /* transmit character */
  51. int     async_rx(int);                          /* receive a character */
  52. int     async_reset(int);                       /* Reset rx error condition */
  53. int     async_stat(int, int);                   /* get stat1/stat2 bytes */
  54. int     async_carrier(int);                     /* fast ck for carrier dtct */
  55. int     async_setbpds(int, char *);             /* change line parameters */
  56. int     async_rxcnt(int);                       /* get # bytes in rx buffer */
  57. int     async_txfree(int);                      /* get bytes free in tx bufr */
  58. int     async_rxflush(int);                     /* flush the receive buffer */
  59. int     async_txflush(int);                     /* flush the transmit buffer */
  60. int     async_msr(int);                         /* get modem status register */
  61. int     async_msrflow(int, int);                /* set MSR related flw cntrl */
  62. int     async_xonoff(int, int);                 /* XON/OFF protocl on/off */
  63. int     async_xoffclr(int);                     /* manually clr XOFF rx'd */
  64. int     async_xonany(int, int);                 /* Any char = XON  on/off */
  65. int     async_dtr(int, int);                    /* DTR on/off */
  66. int     async_rts(int, int);                    /* RTS on/off */
  67. int     async_tximd(int, char *, int);          /* Tx blk data as next out */
  68. int     async_strip(int, char);                 /* Set bit stripping mask */
  69.  
  70.